home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / YICN23.ZIP / UNITS / FMTEST.CPP < prev    next >
C/C++ Source or Header  |  1992-11-18  |  960b  |  48 lines

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <stdlib.h>
  4. #include "sb.h"
  5.  
  6. FM_Instrument instrument = {
  7.     0x11, 0x01, 0x8a, 0x40,
  8.     0xf1, 0xf1, 0x11, 0xb3,
  9.     0x00, 0x00, 0x06, 0x00,
  10.     0x00, 0x00, 0x00, 0x00
  11. };
  12.  
  13. /* Chromatic scale starting from C# */
  14. int notes[12] = {0x16B,0x181,0x198,0x1B0,0x1CA,0x1E5,
  15.                  0x202,0x220,0x241,0x263,0x287,0x2AE};
  16.  
  17. void main()
  18. {
  19.  
  20.     if(Sb_Get_Params())
  21.     {
  22.         puts("BLASTER environment variable not set.");
  23.         exit(1);
  24.     }
  25.  
  26.     Sb_FM_Reset();
  27.  
  28.     Sb_FM_Set_Voice(0,&instrument);
  29.     Sb_FM_Set_Voice(1,&instrument);
  30.     Sb_FM_Set_Voice(2,&instrument);
  31.     Sb_FM_Set_Voice(3,&instrument);
  32.  
  33.     Sb_FM_Key_On(0,notes[11],2);
  34.     Sb_FM_Key_On(1,notes[3],3);
  35.     Sb_FM_Key_On(3,notes[6],3);
  36.     Sb_FM_Key_On(3,notes[11],3);
  37.  
  38.     getch();
  39.  
  40.     Sb_FM_Key_Off(0);
  41.     Sb_FM_Key_Off(1);
  42.     Sb_FM_Key_Off(2);
  43.     Sb_FM_Key_Off(3);
  44.  
  45.     Sb_FM_Reset();
  46. }
  47.  
  48.